package br.com.mayco.util;

import java.io.IOException;
import java.io.Serializable;
import javax.servlet.*;


/**
 * @author Mayco Lucian
 * @since 25/02/2013
 * @version 1.0.0
 */
public class CharacterEncodingFilter implements Filter, Serializable {

    private static final long serialVersionUID = -4246457499875267088L;

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        chain.doFilter(req, resp);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    @Override
    public void destroy() {
    }
}
